package WaiBao;

import java.util.Arrays;

public class JiaDaLin {
    public static void main(String[] args) {
        String[] mingzi = {"李梦华(班长)", "郑德发(副班长)", "小李(学习委员)", "郝俊杰(纪律委员)", "张子文", "李浩吨", "小王子", "沙特", "阿根廷", "李志田", "黄后天", "李存刚",
                "巴西", "大卫", "鲍勃", "艾瑞克", "詹姆士", "唐嫣", "唐艺昕", "杨幂", "胡一菲", "娄艺潇", "曾小贤", "大张伟", "小张伟", "刘华强", "王敏", "杨敏",
                "张潇潇", "贾妲霖(学生)"};//考生本人: 贾妲霖(学生)
        int[] nainling = {21, 20, 19, 18, 20, 21, 21, 21, 19, 19, 18, 19, 18, 20, 22, 20, 18, 21, 18, 18, 19, 19, 20, 20, 20, 18, 19, 19, 18, 21};//考生年龄：21岁

        double[] qingtian1 = {64, 86, 64, 70, 78, 79, 78, 84, 73, 84, 60, 87, 71, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 74, 80, 95};
        double[] qingtian2 = {81, 65, 81, 79, 80, 67, 71, 79, 84, 94, 90, 70, 86, 64, 90, 65, 86, 79, 66, 68, 92, 71, 95, 85, 75, 84, 79, 64, 90, 96};
        double[] qingtian3 = {74, 91, 74, 85, 71, 61, 78, 80, 84, 60, 63, 80, 75, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 89, 96};

        double erji;//代表每个学生的总分
        double lanya;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            erji = qingtian1[i] + qingtian2[i] +qingtian3[i];
//            lanya= (erji * 1.0) / 3;
//            System.out.println(mingzi[i] + "的总分为:" + erji);
//            System.out.println(mingzi[i] + "的平均分为:" + lanya);
//        }

        double guajian1 = 0, guajian2 = 0;
        double[] chongdian = new double[30];
//        for (int i = 0; i < 30; i++) {
//            guajian1 = qingtian1[i] + qingtian2[i] + qingtian3[i];
//            guajian2= (guajian1 * 1.0) / 3;
//            chongdian[i] = guajian2;
//        }
//
//        for (int i = 0; i < chongdian .length - 1; i++) {
//            for (int j = 0; j < chongdian .length - i - 1; j++) {
//                if (chongdian [j] < chongdian [j + 1]) {
//                    double tep = chongdian [j];
//                    chongdian [j] = chongdian [j + 1];
//                    chongdian [j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(chongdian[i]);
//        }


        double guanzi1 = 0,guanzi2 = 0, guanzi3 = 0;//计算每门课的平均分
        double kouzao1 = 0,kouzao2 = 0, kouzao3 = 0;//计算每门课标准差
        double shouji1 = 0,shouji2 = 0, shouji3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < qingtian1.length; i++) {
            sum2+=qingtian1[i];
        }
        guanzi1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+guanzi1);
        double Sum = 0;
        for (int i = 0; i <qingtian2.length; i++) {
            Sum+=qingtian2[i];
        }
        guanzi2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+guanzi2);
        double sum = 0;
        for (int i = 0; i <qingtian3.length; i++) {
            sum+=qingtian3[i];
        }
        guanzi3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+guanzi3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <qingtian1.length; i++) {
            c1+= (qingtian1[i] - guanzi1)*(qingtian1[i] -guanzi1);
        }
        kouzao1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+kouzao1);

        for (int i = 0; i < qingtian2.length; i++) {
            c2+= (qingtian2[i] - guanzi2)*(qingtian2[i] - guanzi2);
        }
        kouzao2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+kouzao2);

        for (int i = 0; i < qingtian3.length; i++) {
            c3+= (qingtian3[i] -guanzi3)*(qingtian3[i] - guanzi3);
        }
        kouzao3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+kouzao3);
////////
//        Arrays.sort(qingtian1);
//        Arrays.sort(qingtian2);
//        Arrays.sort(qingtian3);
//        shouji1 =(qingtian1[14]+qingtian1[15])*1.0/2;
//        shouji2 =( qingtian2[14]+qingtian2[15])*1.0/2;
//        shouji3 =( qingtian3[14]+qingtian3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+shouji1);
//        System.out.println("微生物学的中位数为:"+shouji2);
//        System.out.println("人体组织解剖学的中位数为:"+shouji3);


    }
}
